package com.cy.pj.goods.dao;

import com.cy.pj.goods.pojo.Goods;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class GoodsDaoImpl implements GoodsDao {

    @Autowired
    SqlSession sqlSession;

    @Override
    public List<Goods> findGoods() {
//        使用selectList()方法, 调用Mapper.xml文件中id = findGoods的语句
//        return sqlSession.selectList("GoodsMapper.findGoods");

//        使用getMapper()方法 获取生成的实例, 然后调用findGoods()方法.
        return sqlSession.getMapper(GoodsDao.class).findGoods();
    }

}
